#include <iostream>
#include "mprpcapplication.h"
#include "mprpcchannel.h"
#include "user.pb.h"
#include <muduo/base/Logging.h>
#include "mprpccontroller.h"
int main(int argc,char** argv)
{
    MrpcApplication::Init(argc,argv);
    fixbug::UserServiceRpc_Stub stub(new MprpcChannel());
    fixbug::LoginRequest request;
    request.set_name("zhang san");
    request.set_pwd("123456");

    fixbug::LoginResponse response;

    MprpcController controller;
    
    stub.Login(&controller,&request,&response,nullptr);

    if(controller.Failed())
    {
        std::cout<<controller.ErrorText()<<std::endl;
    }
    else{
        if(response.result().errcode()==0)
        {
            LOG_INFO<<"LOGIN SUCCESS\n";
        }
        else{
            LOG_INFO<<"LOGIN ERROR\n";
        }
        
    }

    

    //register
    /*
    fixbug::RegisterRequest rerequest;
    rerequest.set_userid(1);
    rerequest.set_pwd("123456");

    fixbug::RegisterResponse reresponse;
    stub.Register(nullptr,&rerequest,&reresponse,nullptr);

    
    if(reresponse.result().errcode()==0)
    {
        LOG_INFO<<"Register SUCCESS\n";
    }
    else{
        LOG_INFO<<"Register ERROR\n";
    }
        */
    return 0;
}